<?php defined('SYSPATH') OR die('No direct access allowed.'); ?>
<script type="text/javascript">
$(document).ready(function() {
	$("input[name='btnAdd']").click(function() {
		var uri = ISS.lang.getBasePath()+'index.php/admin/artist/add';
		window.location = uri;
	});

	$(".pagination a").click(function() {
		var uri = $(this).attr('href'); 
		ISS.Ajax.Caller.request(uri, null);		
		return false;
	});

	$(".actionDel").click(function() {
		if (confirm('คุณต้องการลบ ใช่หรือไม่?')) {
			var uri = $(this).attr('href'); 
			ISS.Ajax.Caller.request(uri, null);	
		}	
		return false;
	});
}); 
</script>

<?php 	
	echo html::Stylesheet(
		array
		(
			'media/css/artist_block.css',
		),
		array
		(
			'screen',
		)
	);	
?>

<div id="mainCont">
	<h3>รายการศิลปิน</h3>
	<table>
	    <tr>
	        <th>ชื่อศิลปิน</th>
	        <th>คำสั่ง</th>
	    </tr>
	    <?php 
	    	$i = 0;
	    	foreach ($artists as $item): 
	    		$i++;
	    		echo (($i % 2)==0) ? '<tr class="artistListDark">' : '<tr class="artistListLight">';
	    ?>
	        <td><?php echo html::specialchars($item->name); ?></td>
	        <td>
	        	<a class='actionEdit' href="<?php echo url::base(); ?>/index.php/admin/artist/edit/<?php echo $item->id; ?>" ><img alt="แก้ไข" src="<?php echo url::base();?>/media/images/edit.png"/></a>
	        	<a class='actionDel' href="<?php echo url::base(); ?>/index.php/admin/artist/del/<?php echo $item->id; ?>" ><img alt="ลบ" src="<?php echo url::base();?>/media/images/delete.png"/></a>
	        </td>
	        
	    </tr>
	    <?php endforeach ?>
	</table>
	
	<?php echo $pagination ?>
	
	<input type="button" name="btnAdd" value="เพิ่ม">
</div>